Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tap-reader

Package Overview
Dependencies
Maintainers
0
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tap-reader

A smol, streaming TAP parser.

  • 0.2.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

tap-reader 📜

A smol, streaming TAP parser. Works well with tape.
tap-reader on npmjs.org »
Documentation soon...

Sample reporter that leverages tap-reader:

#!/usr/bin/env node
import { stdin } from 'node:process';
import TapReader from 'tap-reader'

const write = console.log
const reader = TapReader({ input: stdin });

reader.on('version', ({ version }) => {
  write('VERSION', version);
});

reader.on('pass', ({ id, desc, skip, todo }) => {
  write('PASS', id, desc, todo ? 'TODO' : skip ? 'SKIP' : '');
});

reader.on('fail', ({ id, desc, skip, todo, diag }) => {
  write('FAIL', id, desc, todo ? 'TODO' : skip ? 'SKIP' : '');
  
  for (const key in diag)
    write(`  ${key}: ${diag[key]}`);
});

reader.on('plan', ({ plan, comment, todo }) => {
  write(`plan: ${plan[0]}${plan[1]} ${comment || ''} ${todo ? 'TODO' :''}`);
})

reader.on('comment', ({ comment, todo, skip }) => {
  write('COMMENT', comment, todo ? 'TODO' : skip ? 'SKIP' : '');
})

reader.on('other', ({ line }) => {
  if (line.trim().length > 0) write('OTHER', line);
})

reader.on('done', ({ summary, ok }) => {
  const { total, pass, fail, skip, todo } = summary;

  write('DONE')
  write(`total: ${total}`)
  write(`pass: ${pass}`)
  write(`fail: ${fail}`)
  write(`skip: ${skip}`)
  write(`todo: ${todo}`)
  write(`OK ${ok}`)
})

reader.on('end', ({ ok }) => {
  process.exit(ok ? 0 : 1);
})

Also see examples/table-reporter.js for another example.

Coming next:

  • More TAP features like subtests, +pragmas, etc.
  • Documentation for config and events
  • Intellisense via .d.ts

FAQ:

Why is yaml vendored?
Because the published module is large. tap-reader should install and run as quickly as possible in a CI environment.
I'm not stoked on it so this may change in the future.

Why not use tap-parser?
tap-parser is great but... see above.

Keywords

FAQs

Package last updated on 29 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc